"""
文件类型 枚举类
"""

from typing import (
    Dict,
    Tuple,
)

from utils.enum_utils.base import (
    IntegerEnum,
    StringEnum,
)


class FileType(StringEnum):
    """ 文件类型 枚举类 """

    IMAGE = "IMAGE", "图片"
    AUDIO = "AUDIO", "音频"
    VIDEO = "VIDEO", "视频"
    TEXT = "TEXT", "文本"
    OFFICE = "OFFICE", "Office"
    ZIP = "ZIP", "压缩文件"
    CONFIG = "CONFIG", "配置文件"
    EXECUTABLE = "EXECUTABLE", "可执行文件"
    OTHER = "OTHER", "其他文件"


class ImageType(IntegerEnum):
    """ 图片 类型后缀 枚举类 """

    JPEG = 1, "jpeg"
    JPG = 2, "jpg"
    GIF = 3, "gif"
    TIF = 4, "tif"
    BMP = 5, "bmp"
    ICO = 6, "ico"
    PNG = 7, "png"


class AudioType(IntegerEnum):
    """ 音频 类型后缀 枚举类 """

    MP3 = 1, "mp3"
    WAV = 2, "wav"
    WMA = 3, "wma"
    AAC = 4, "aac"
    FLAC = 5, "flac"  # noqa
    AU = 6, "au"


class VideoType(IntegerEnum):
    """ 视频 类型后缀 枚举类 """

    MP4 = 1, "mp4"
    AVI = 2, "avi"
    MPG = 3, "pmg"
    MPEG = 4, "mpeg"  # noqa
    MOV = 5, "mov"
    RM = 6, "rm"
    RMVB = 7, "rmvb"  # noqa
    SWF = 8, "swf"
    FLV = 9, "flv"


class TextType(IntegerEnum):
    """ 文本 类型后缀 枚举类 """

    TXT = 1, "txt"
    MD = 2, "md"


class OfficeType(IntegerEnum):
    """ Office 类型后缀 枚举类 """

    DOC = 1, "doc"
    DOCX = 2, "docx"  # noqa
    PPT = 3, "ppt"
    PPTX = 4, "pptx"  # noqa
    XLS = 5, "xls"
    XLSX = 6, "xlsx"  # noqa
    PDF = 7, "pdf"
    WPS = 8, "wps"


class ZipType(IntegerEnum):
    """ 压缩文件 类型后缀 枚举类 """

    ZIP = 1, "zip"
    RAR = 2, "rar"
    GZ = 3, "gz"
    TAR = 4, "tar"
    SEVEN_Z = 5, "7z"


class ConfigType(IntegerEnum):
    """ 配置 类型后缀 枚举类 """

    YML = 1, "yml"
    YAML = 2, "yaml"
    XML = 3, "xml"
    INI = 4, "ini"
    JSON = 5, "json"
    CONFIG = 6, "config"
    CONF = 7, "conf"
    CFG = 8, "cfg"


class ExecutableType(IntegerEnum):
    """ 可执行文件 类型后缀 枚举类 """

    EXE = 1, "exe"
    SH = 2, "sh"
    MSI = 3, "msi"
    BAT = 4, "bat"
    COM = 5, "com"


class OtherType(IntegerEnum):
    """ 其他 类型后缀 枚举类 """

    HTM = 1, "htm"
    HTML = 2, "html"
    CSS = 3, "css"
    JS = 4, "js"
    SQL = 5, "sql"


FILE_TYPE_DICT: Dict[str, Tuple[str, ...]] = {  # noqa
    FileType.IMAGE.value: ImageType.labels,
    FileType.AUDIO.value: AudioType.labels,
    FileType.VIDEO.value: VideoType.labels,
    FileType.TEXT.value: TextType.labels,
    FileType.OFFICE.value: OfficeType.labels,
    FileType.ZIP.value: ZipType.labels,
    FileType.CONFIG.value: ConfigType.labels,
    FileType.EXECUTABLE.value: ExecutableType.labels,
    FileType.OTHER.value: OtherType.labels,
}
""" 文件类型映射 """
